package link.cocoon.finance;

import link.cocoon.common.resp.Resp;
import link.cocoon.common.resp.RespData;
import link.cocoon.finance.util.AnnualReportInfo;
import link.cocoon.finance.util.MillionaireUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Cocoon
 * @date 2020/4/8  15:43
 */
@RestController
@RequestMapping( "/finance/millionaire" )
public class MillionaireController {

  @PostMapping( "/annualReport" )
  public Resp annualReport(@RequestBody AnnualReportInfo annualReportInfo) {
    try {
      MillionaireUtil.getAnnualReportInfo(annualReportInfo);
      return RespData.success(annualReportInfo);
    } catch (ArithmeticException e) {
      e.printStackTrace();
      return RespData.error("请填写正确的参数");
    }

  }

}
